﻿

// 功能集合
Funcs = {};

Funcs.navigateData = {
    text: 'EHSubmit 功能导航', singleClickExpand: true, expanded: true, children: [
        { id: 'personManageNode', text: '个人中心', expanded: true, singleClickExpand: true, children: [
            { targetWin: 'targetWin', text: "个人信息", "id": "detailsNode", leaf: true },
            { targetWin: 'targetWin', text: "修改密码", "id": "codeNode", leaf: true }
        ] },
        { id: 'homeworkNode', text: '作业管理', expanded: true, singleClickExpand: true, children:[
            { targetWin: 'targetWin', text: "提交作业", "id": "submitNode", leaf: true },
            { targetWin: 'targetWin', text: "所有作业", "id": "homeworksNode", leaf: true }
            //{ targetWin: 'targetWin', text: "修改作业", "id": "updateNode", leaf: true }
        ]},
        { id: 'messageNode', text: '消息箱', expanded: true, singleClickExpand: true, children: [
            { targetWin: 'targetWin', text: "收件箱", "id": "inboxNode", leaf: true },
            { targetWin: 'targetWin', text: "发件箱", "id": "outboxNode", leaf: true },
            { targetWin: 'targetWin', text: "垃圾箱", "id": "trashNode", leaf: true }
        ]},
        { id: 'analysisNode', text: '统计与分析', expanded: true, singleClickExpand: true, children: [
            { targetWin: 'targetWin', text: "综合分析", "id": "simpleNode", leaf: true }
        ]
        },
         { id: 'BBSNode', text: '答疑平台', expanded: true, singleClickExpand: true, children: [
            { targetWin: 'targetWin', text: "答疑平台", "id": "BBS_formNode", leaf: true }
        ]
        }
    ]
};


// 菜单类，继承自TreePanel
MenuTreePanel = function() {
    MenuTreePanel.superclass.constructor.call(this, {
        title:'功能导航',
        id: 'menu-tree',
        region: 'west',
        split: true,
        width: 240,
        minSize: 240,
        maxSize: 400,
        collapsible: true,
        margins: '0 0 0 5',
        cmargins: '0 0 0 0',
        rootVisible: false,
        lines: false,
        autoScroll: true,
        animCollapse: false,
        animate: false,
        collapseMode: 'mini',
        loader: new Ext.tree.TreeLoader({
            preloadChildren: true,
            clearOnLoad: false
        }),
        root: new Ext.tree.AsyncTreeNode({
            text: 'EHSubmit Tree',
            id: 'root',
            expanded: true,
            children: [Funcs.navigateData]
        }),
        collapseFirst: false
    });
    // no longer needed!
    //new Ext.tree.TreeSorter(this, {folderSort:true,leafAttr:'isClass'});

    this.getSelectionModel().on('beforeselect', function(sm, node) {
        return node.isLeaf();
    });
};

Ext.extend(MenuTreePanel, Ext.tree.TreePanel, {
    initComponent: function() {
        Ext.apply(this, {
            tbar: [
            '选择皮肤',
			{
			    xtype: 'themeChange'
			    //width:'100'
			}
			]
        })
        MenuTreePanel.superclass.initComponent.call(this);
    }
});